home *** CD-ROM | disk | FTP | other *** search
/ Amiga Games: Greatest Hits 1996 / Amiga Games: Greatest Hits 1996.iso / archive / userbox / publicdomain / engclock_v7.0.lha / EngClock_v7.0 / EngClock7_Source / talk.c < prev    next >
C/C++ Source or Header  |  1996-01-23  |  2KB  |  86 lines

  1. /****************************************/
  2. /*  Talk module for English Clock v3.0  */
  3. /*  ==================================  */
  4. /*           Version 1.0                */
  5. /*      Last revised: 23/08/95          */
  6. /****************************************/
  7.  
  8. /* This module is totally seperate from the English clock main code
  9.    and as such must be linked in as a module and link time.  For those
  10.    in need of a high-level routine such as this, feel free to use it in
  11.    your own programs, although you would have to be a bit sad to want
  12.    this! */
  13.  
  14. #include <stdio.h>
  15. #include <string.h>
  16. #include <exec/types.h>
  17. //#include <proto/exec.h>
  18. #include <devices/narrator.h>
  19. //#include <proto/dos.h>
  20. //#include <proto/intuition.h>
  21.  
  22. #include <clib/exec_protos.h>
  23. #include <clib/dos_protos.h>
  24. #include <clib/intuition_protos.h>
  25. #include <dos/dos.h>
  26. #include <dos/dostags.h>
  27.  
  28.  
  29. BOOL talk(char *text);
  30.  
  31. BOOL talk(char *text) {
  32.  
  33.    /**************************/
  34.    /*          talk          */
  35.    /*          ----          */
  36.    /* One input, char *text  */
  37.    /* ptr to string of       */
  38.    /* phonetics.  Returns    */
  39.    /* 1 success, 0 failure   */
  40.    /**************************/
  41.  
  42.    struct MsgPort *VoiceMP;
  43.    struct narrator_rb *VoiceIO;
  44.    BYTE audio_chan[4];
  45.  
  46.    audio_chan[0]=3; audio_chan[1]=5; audio_chan[2]=10; audio_chan[3]=12;
  47.  
  48.    VoiceMP=CreateMsgPort();
  49.    if(!VoiceMP) {
  50.       DisplayBeep(NULL);
  51.       return/*(0)*/;
  52.    }
  53.  
  54.    VoiceIO=CreateIORequest(VoiceMP,sizeof(struct narrator_rb));
  55.    if(!VoiceIO) {
  56.       DisplayBeep(NULL);
  57.       DeleteMsgPort(VoiceMP);
  58.       return/*(0)*/;
  59.    }
  60.  
  61.    VoiceIO->flags=NDF_NEWIORB;
  62.  
  63.    if(OpenDevice("narrator.device",0,(struct IORequest *)VoiceIO,NULL)) {
  64.       //DisplayBeep(NULL);
  65.       DeleteIORequest(VoiceIO);
  66.       DeleteMsgPort(VoiceMP);
  67.       return/*(0)*/;
  68.    }
  69.  
  70.    VoiceIO->ch_masks=&audio_chan[0];
  71.    VoiceIO->nm_masks=sizeof(audio_chan);
  72.    VoiceIO->message.io_Command=CMD_WRITE;
  73.    VoiceIO->message.io_Data=text;
  74.    VoiceIO->message.io_Length=strlen(text);
  75.  
  76.    DoIO((struct IORequest *)VoiceIO);
  77.  
  78.    CloseDevice((struct IORequest *)VoiceIO);
  79.    DeleteIORequest(VoiceIO);
  80.    DeleteMsgPort(VoiceMP);
  81.  
  82.    //return(1);
  83.  
  84. }
  85.  
  86.